#include "UtilityPCH.h"
#include "UT_BRDFSpecularReflection.h"
#include "UT_MathHelper.h"

using namespace Utility;
//-------------------------------------------------------------------------
UT_BRDF_SpecularReflection::UT_BRDF_SpecularReflection(const UT_SpectrumUsed& r, UT_FresnelBase* f)
	: UT_BxDFBase(BxDFType(BSDF_REFLECTION | BSDF_SPECULAR))
	, m_kReflective(r)
	, m_pkFresnel(f)
{
}
//-------------------------------------------------------------------------
UT_SpectrumUsed UT_BRDF_SpecularReflection::f(const UT_Vec3Float& wo, const UT_Vec3Float& wi) const
{
	return 0;
}
//-------------------------------------------------------------------------
UT_SpectrumUsed UT_BRDF_SpecularReflection::Sample_f(const UT_Vec3Float& wo, UT_Vec3Float* wi, float u1, float u2, float *pdf) const
{
	*wi = UT_Vec3Float(-wo.x, -wo.y, wo.z);
	*pdf = 1.f;
	return m_pkFresnel->Evaluate(UT_MathHelper::ComputeSphericalCosTheta(wo)) * m_kReflective / UT_MathHelper::ComputeSphericalAbsCosTheta(*wi);
}
//-------------------------------------------------------------------------
float UT_BRDF_SpecularReflection::Pdf(const UT_Vec3Float& wi, const UT_Vec3Float& wo) const
{
	return 0;
}
//-------------------------------------------------------------------------